home *** CD-ROM | disk | FTP | other *** search
- 4xFORTH Level 1 Graphics
-
-
-
- Overview
- --------
-
- Although the Level 1 system does not support the full GEM
- interface for the Atari computer, it does support a number
- of graphics functions. Some of these are to routines which
- lie at the core of the GEM system, called "line A" graphics,
- while others are more complex calls built using the "line A"
- routines.
-
-
- Screen Coordinates
- ------------------
-
- The Atari screen pixel numbering system begins with x=0, y=0 at
- the upper left corner of the screen. All calls requiring x and
- y positions REQUIRE absolute pixel numbers based in this coordi-
- nate system. If you wish to provide routines which will run on
- all display devices, regardless of their height and width in
- absolute pixels, we suggest you add routines above these primi-
- tives which scale a "virtual coordinate" to the physical one
- and then call the primitive. This might be done in the following
- way:
-
- V RYMAX \ real screen y max
- V RXMAX \ real screen x max
-
- V VYMIN \ virtual window y min
- V VXMIN \ virtual window x min
- V VYMAX \ virtual window y max
- V VXMAX \ virtual window x max
-
- ( remember: V is a legal contraction of VARIABLE )
-
- : SCALER ( <virtual x> <virtual y> --- <screen x> <screen y> )
- VYMIN @ - \ calc y distance from
- \ virtual origin
- RYMAX @ VYMAX @ VYMIN @ - W*/ \ scale y value
- >R \ save new Y coordinate
- VXMIN @ - \ calc x distance from
- \ virtual origin
- RXMAX @ VXMAX @ VXMIN @ - W*/ \ scale x value
- R> ; \ restore y
-
- \ convert virtual x,y to screen x,y
- \ assumes that virtual coordinate system
- \ is not larger that 0 to 65000
-
-
-
- Variables in the Graphics system
- --------------------------------
-
- The following are variables used in the graphics system:
-
-
- VARIABLE CUR.X GRAPHICS
-
- This 16 bit variable contains the current absolute x
- screen pixel value at which the logical screen painting
- beam is located. It is initialized to zero after the
- execution of ORIGIN. The contents of this variable are
- kept current by the graphics routines. W@ and W! operators
- should be used in accessing this variable.
-
-
-
- VARIABLE CUR.Y GRAPHICS
-
- This 16 bit variable contains the current absolute y
- screen pixel value at which the logical screen painting
- beam is located. It is initialized to zero after the
- execution of ORIGIN. The contents of this variable are
- kept current by the graphics routines. W@ and W! operators
- should be used in accessing this variable.
-
-
- VARIABLE PAT_PNTR GRAPHICS
-
- PAT_PNTR will contain a 32b address value which is used by
- several routines to point to a 16 (16b) word array to be used
- as the pattern control for filled areas. There are really
- four arrays, one after another, which are used to control the
- fill in each of the ST's color planes. If the variable
- MULTI_FILL is set to 0, only the first of these arrays is
- actually used for control. The user may provide his own
- pattern, or he may use one of the 18 provided with 4xFORTH.
- See PATTERNS, and note the fills used in the demo program.
-
-
- VARIABLE MULTI_FILL GRAPHICS
-
- This 16 bit variable is a flag which is used in those
- operations which control area filling. If it is set to
- 0, the pattern fill will use only the first of the 16 w
- x 16b arrays pointed to by PAT_PNTR for control of the
- fill. Any other value will cause the correct number
- of 16 bit arrays to be used depending on the number of
- color planes currently being used by the display. That
- is controlled by the resolution setting of the system.
-
-
- Arrays in the Graphics System
- -----------------------------
-
- ARRAY FULL.PATTERN GRAPHICS
-
- FULL.PATTERN is an array whose address is placed in PAT_PNTR
- when solid fills are desired.
-
-
- ARRAY PATTERNS GRAPHICS
-
- The array PATTERNS contains the addresses of 18 fill patterns,
- named P1 thru P18, which are provided with the 4xFORTH system.
- The contents of the patterns may be seen in the demo. Their
- addresses are provided in this array for use with loop "I counter
- selection.
-
-
- Graphics Primitive Routines
- ---------------------------
-
- COLON CLEAR GRAPHICS
-
- Clear the screen.
-
-
- COLON ORIGIN GRAPHICS
-
- Set the position of the logical screen painting beam at
- X=0,Y=0. This should be executed prior to the execution of
- any routine which moves the beam or paints any lines on the
- screen.
-
-
- COLON CLIP.WINDOW GRAPHICS
-
- ( <x1><y1> <x2><y2> --- )
-
- CLIP.WINDOW uses the specified values to establish the size
- and the location of a rectangle which will be displayed for
- those routines which allow clipping, and the calls to which
- indicate that clipping should be applied.
-
-
- CODE DRAW.LINE GRAPHICS
-
- ( <x1><y1> <x2><y2> <mode> --- )
-
- DRAW.LINE draws a line from X1,Y1 to X2,Y2. The arguments
- are absolute screen coordinates. The mode value means:
-
- 0 = replace mode
- 1 = transparent mode
- 2 = XOR mode
- 3 = inverse transparent mode
-
- DRAW.LINE updates the variables CUR.X and CUR.Y so that the
- programmer may query them for the current position of the
- logical beam. DRAW.LINE is the basis of the Tektronix
- 4010 line instructions MOV, DRW, RMOV, and RDRW.
-
-
- CODE RECTANGLE GRAPHICS
-
- ( <x1><y1> <x2><y2> <clip flg><mode> --- )
-
- RECTANGLE paints a rectangle whose TOP left corner is x1,y1
- and lower right corner is x2,y2. If the clip flag is 0, no
- clipping window is applied. If it is set to -1, clipping is
- done to the window set using the CLIP.WINDOW definition. The
- mode flag meaning is:
-
- 0 = replace mode
- 1 = transparent mode
- 2 = XOR mode
- 3 = inverse transparent mode
-
- Fill is controlled by the PAT_PNTR value and the MULTI_FILL
- flag.
-
-
- Basic TEK4010 Drawing routines
- ------------------------------
-
- COLON MOV GRAPHICS
-
- ( <x> <y> --- )
-
- MOV from the current position to the specified X,Y position
- with the logical beam OFF. This emulates the 4010 command
- MOVE.
-
-
- COLON DRW GRAPHICS
-
- ( <x> <y> --- )
-
- DRW causes a line to be drawn from the current position to
- the X,Y position specified in the call. DRW emulates the
- TEK4010 command DRAW.
-
-
- COLON RMOV GRAPHICS
-
- ( <x> <y> --- )
-
- RMOV moves the beam to a new position which is the sum of
- the current position and the relative pixel values given
- in the call. The relative nature of this command makes
- it ideal for construction of figures whose size or position
- is likely to be changed.
-
-
- COLON RDRW GRAPHICS
-
- ( <x> <y> --- )
-
- RDRW paints a line from the current position of the beam to
- a new position which is calculated from the original beam
- position plus the relative pixel values given in the call.
- The relative nature of this command makes it ideal for the
- construction of figures whose size or position is likely to
- be changed.
-
-
- Color Specification
- -------------------
-
- COLON RED GRAPHICS
-
- Set the foreground color to red.
-
-
- COLON GREEN GRAPHICS
-
- Set the forground color to green.
-
-
- COLON BLACK GRAPHICS
-
- Set the foreground color to black.
-
-
- COLON WHITE GRAPHICS
-
- Set the foreground color to white.
-
-
- Simple Figures
- --------------
-
- COLON BOX GRAPHICS
-
- ( <x size> <y size> --- )
-
- Draw a rectangle using the current x,y position as the
- upper left corner. Use the specified values as the
- size of the box in absolute screen coordinates. Leave
- the beam at the upper left corner of the box.
-
-
- COLON TRI.UP GRAPHICS
-
- ( <x size> --- )
-
- Paint a triangle with the point up around the current position
- of the cursor. Use the specified value as the size in the
- x direction. Scale the y direction so that the triangle is
- properly shaped. Return the beam to its position prior to
- the call.
-
-
- COLON TRI.DN GRAPHICS
-
- ( <x size> --- )
-
- Do the same function as TRI.UP except paint a triangle with the
- point down.
-
-
-
- COLON DIAMOND GRAPHICS
-
- ( <x size> --- )
-
- Do the same function as TRI.UP except paint a diamond.
- ə